<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="utf-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <meta name="description" content="">
        <meta name="author" content="">
        <link rel="icon" href="../../favicon.ico">
        <title><?php echo $OJ_NAME?></title>
        <?php include("template/$OJ_TEMPLATE/css.php");?>
        <!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
        <!--[if lt IE 9]>
        <script src="http://cdn.bootcss.com/html5shiv/3.7.0/html5shiv.js"></script>
        <script src="http://cdn.bootcss.com/respond.js/1.4.2/respond.min.js"></script>
        <![endif]-->
    </head>

    <body>
        <div class="container">
            <?php include("template/$OJ_TEMPLATE/nav.php");?>
            <div class="jumbotron col-md-12">
                <h4>题目: <a href="problem.php?id=<?php echo $problemInfo['id']?>">
                        <?php echo $problemInfo['id'].$problemInfo['title'];?>
                </a></h4>
                <div class="container  col-md-12">
                    <table id='statics' class="col-md-3" >
                        <?php
                        $cnt=1;
                        foreach( $view_problem as $row ) {
                            if ( $cnt % 2 ) {
                                echo "<tr class='oddrow'>";
                            }
                            else {
                                echo "<tr class='evenrow'>";
                            }
                            foreach($row as $table_cell) {
                                echo "<td>";
                                echo "\t".$table_cell;
                                echo "</td>";
                            }
                            echo "</tr>";
                            $cnt ++;
                        }
                        ?>
                        <tr id="end"></tr>
                    </table>
                    <div class="col-md-1"></div>
                    <div id='PieDiv' class="col-md-5">
                    </div>
                </div>
            </div>

            <div class="jumbotron  col-md-12">
                <h4>提交记录(<span style="color: blue">综合占用内存和耗时由低到高排序</span>)</h4>
                <table id="problemstatus" class="col-md-12">
                    <thead>
                        <tr class=toprow>
                            <th style="cursor:hand" onclick="sortTable('problemstatus', 0, 'int');">
                                序号
                            </th>
                            <th>提交编号</th>
                            <th>用户名</th>
                            <th>姓名</th>
                            <th><?php echo $MSG_MEMORY?></th>
                            <th><?php echo $MSG_TIME?></th>
                            <th><?php echo $MSG_LANG?></th>
                            <th><?php echo $MSG_CODE_LENGTH?></th>
                            <th><?php echo $MSG_SUBMIT_TIME?></th>
                        </tr>
                    </thead>
                    <tbody>
                    <?php
                    $cnt=0;
                    foreach($view_solution as $row){
                        if ($cnt)
                            echo "<tr class='oddrow'>";
                        else
                            echo "<tr class='evenrow'>";
                        foreach($row as $table_cell){
                            echo "<td>";
                            echo "\t".$table_cell;
                            echo "</td>";
                        }
                        echo "</tr>";
                        $cnt=1-$cnt;
                    }
                    ?>
                </table>
            </div>
        </div>

        <script type="text/javascript" src="include/wz_jsgraphics.js"></script>
        <script type="text/javascript" src="include/pie.js"></script>
        <script language="javascript">
            // 获取table中的数据绘制饼图
            var y= new Array ();
            var x = new Array ();
            var dt=document.getElementById("statics");
            var data=dt.rows;
            var n;
            for( var i=3; dt.rows[i].id!="end"; i++) {
                x.push(dt.rows[i].cells[0].innerHTML);
                n=dt.rows[i].cells[1];
                n=n.innerText || n.textContent;
                n=parseInt(n);
                y.push(n);
            }
            var mypie = new Pie("PieDiv");
            mypie.drawPie(y,x);
        </script>

        <?php include("template/$OJ_TEMPLATE/js.php");?>
        <script type="text/javascript" src="include/jquery.tablesorter.js"></script>
        <script type="text/javascript">
            $(document).ready(function() {
                    $("#problemstatus").tablesorter();
            });
  </body>
</html>
